//$Author: jianpx86 $
//$Revision: 5 $
/*
 * Author       : jianpx86@gmail.com
 * Licence      : New BSD Licence
 * Description  : combine javascript function and dict to manage your namespace of js code.
 */
var my_namespace = (function (){
    //private variable that only inner function can access
    var private_var = 3;
    var status = {};
    function private_func(){
        //do something
        alert("private func here!");
    }

    //public function
    function add(x,y){
        //can call private function
        //private_func();
        return x + y;
    }

    status.add = add;
    //of course , you can add:
    //status.divide = function divide(x, y){....}
    return status;

})();

//namespace assertion.
if(typeof upper_ns == "undefined")
{
    // if you want to add upper namespace , you can do it like this.
    var upper_ns = {} // upper namespace
}

/*
 * usage: upper_ns.my_namespace.add(5,7);
 */
upper_ns.my_namespace = my_namespace;
